﻿using DataAccess.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XYD.DataAccess;
using XYD.Framework.Data;
using XYD.Framework.Data.Dapper;


namespace DataAccess.DAL
{
    public class WithdrawDAL : BaseDAL
    {
        public Withdraw Get(int id)
        {
            return CONN_TopicSharing.Get<Withdraw>(id);
        }

        public bool Insert(Withdraw Withdraw)
        {
            return CONN_TopicSharing.Insert<Withdraw>(Withdraw);
        }

        public bool Update(Withdraw Withdraw)
        {
            return CONN_TopicSharing.Update<Withdraw>(Withdraw);
        }

        public bool Exist(int au_id,int type)
        {
            string sql = " select * from [Withdraw] where au_id=@au_id and type=@type ";

            return CONN_TopicSharing.Excute(sql, new { au_id = au_id ,type=type})>0;
        }


        public List<Withdraw> GetWithdraw(string au_id)
        {
            string sql = string.Format(" select * from  Withdraw where au_id='{0}' ", au_id);

            List<Withdraw> Withdraw = CONN_TopicSharing.SQLQuery<Withdraw>(sql, null).ToList();

            return Withdraw;
        }



    }
}
